﻿using RssReader.FeedProvider;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace RssReader.Common
{
    public class VariableGridView : GridView
    {
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            var viewModel = item as Item;

            if (viewModel != null)
            {
                element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, viewModel.Column_span);
                element.SetValue(VariableSizedWrapGrid.RowSpanProperty, viewModel.Row_span);
            }

            base.PrepareContainerForItemOverride(element, item);
        }
    }
}
